//
//  BMHHTTPSession.h
//  BeautyVideos
//
//  Created by 爆米花 on 16/10/12.
//  Copyright © 2016年 mac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger,HTTPSRequestType)
{
    HTTPSRequestTypeGet = 0,
    HTTPSRequestTypePost
    
};

// json数据回调
typedef void (^HttpSuccessBlock)(id  _Nullable JSON);
typedef void (^HttpFailureBlock)(NSError * _Nullable error);
typedef void(^completeBlock)(id _Nullable JSON,NSError * _Nullable error);
typedef void(^DownloadImgCompletedBlock)(UIImage * _Nullable img);
@interface BMHHTTPSession : NSObject

+(nullable NSURLSessionDataTask *)GET:(nonnull NSString *)urlstring
                            paraments:(nullable id)paraments
                        completeBlock:(nullable completeBlock)completeBlock;

+(nullable NSURLSessionDataTask *)GET:(nonnull NSString *)urlstring
                            paraments:(nullable id)paraments
                              success:(nullable HttpSuccessBlock)success
                              failure:(nullable HttpFailureBlock)failure;

+(nullable NSURLSessionDataTask *)GETKK:(nonnull NSString *)urlstring
                              paraments:(nullable id)paraments
                                success:(nullable HttpSuccessBlock)success
                                failure:(nullable HttpFailureBlock)failure;

+(nullable NSURLSessionDataTask *)TMGET:(nonnull NSString *)urlstring
                            paraments:(nullable id)paraments
                              success:(nullable HttpSuccessBlock)success
                              failure:(nullable HttpFailureBlock)failure;

+(nullable NSURLSessionDataTask *)GETTEST:(nonnull NSString *)urlstring
                              paraments:(nullable id)paraments
                                success:(nullable HttpSuccessBlock)success
                                failure:(nullable HttpFailureBlock)failure;


/**
 BMHVIDEO

 @param urlstring BMHVideoURL
 @param paraments id
 @param success   result
 @param failure   result
 @return json
 */
+(nullable NSURLSessionDataTask *)GETBMHVideo:(nonnull NSString *)urlstring
                                    paraments:(nullable id)paraments
                                      success:(nullable HttpSuccessBlock)success
                                      failure:(nullable HttpFailureBlock)failure;


/**
 BMHVIDEOTEST

 @param urlstring BMHVideoURLTEST
 @param paraments id
 @param success   result
 @param failure   result
 @return json
 */
+(nullable NSURLSessionDataTask *)GETBMHVideoTEST:(nonnull NSString *)urlstring
                                        paraments:(nullable id)paraments
                                          success:(nullable HttpSuccessBlock)success
                                          failure:(nullable HttpFailureBlock)failure;

+ (nullable NSURLSessionDataTask *)POST:(nonnull NSString *)urlString
                              paraments:(nullable id)paraments
                          completeBlock:(nullable completeBlock)completeBlock;

+ (nullable NSURLSessionDataTask *)POST:(nonnull NSString *)urlString
                              secretKey:(nonnull NSString *)secretKey
                              paraments:(nullable id)paraments
                                success:(nullable HttpSuccessBlock)success
                                failure:(nullable HttpFailureBlock)failure;


+ (nullable NSURLSessionDataTask *)requestWithRequestType:(HTTPSRequestType)type
                                                urlString:(nonnull NSString *)urlString
                                                paraments:(nullable id)paraments
                                            completeBlock:(nullable completeBlock)completeBlock;


//上传头像
+(nullable NSURLSessionDataTask *)UploadHeadGET:(nonnull NSString *)urlstring
                            paraments:(nullable id)paraments
                              success:(nullable HttpSuccessBlock)success
                              failure:(nullable HttpFailureBlock)failure;
+ (nullable NSURLSessionDataTask *)UploadHeadPOST:(nonnull NSString *)urlString
                                        paraments:(nullable id)paraments
                                         pictures:(nullable NSArray *)pics
                                    completeBlock:(nullable completeBlock)completeBlock;

+ (nullable NSURLSessionDataTask *)UploadHeadPOST:(nonnull NSString *)urlString
                                        paraments:(nullable id)paraments
                                         pictures:(nullable NSArray *)pics
                                          success:(nullable HttpSuccessBlock)success
                                          failure:(nullable HttpFailureBlock)failure;




//猜拳游戏
+ (nullable NSURLSessionDataTask *)getWithGamePath:(nonnull NSString *)path
                                            params:(nullable NSDictionary *)params
                                           success:(nullable HttpSuccessBlock)success
                                           failure:(nullable HttpFailureBlock)failure;

#pragma mark - 加载图片
+ (void)downloadImage:(nonnull NSString *)url completed:(nullable DownloadImgCompletedBlock)completed imageView:(nullable UIImageView *)imageView;


- (void)AFNetworkStatus;



@end
